home *** CD-ROM | disk | FTP | other *** search
- ;*************************************************************************
- ;** mmu.library **
- ;** **
- ;** a system library for arbitration and control of the MC68K MMUs **
- ;** **
- ;** © 1998 THOR-Software, Thomas Richter **
- ;** No commercial use, reassembly, modification without prior, written **
- ;** permission of the authors. **
- ;** Including this library in any commercial software REQUIRES a **
- ;** written permission and the payment of a small fee. **
- ;** **
- ;** This is an internal header file, do not depend on anything here. **
- ;** Use the official include files. **
- ;** Distributed only for the mmu.library development group for private **
- ;** use. **
- ;** **
- ;**---------------------------------------------------------------------**
- ;** Block: The context **
- ;** Definition of the "Context", the basic object of the mmu.lib **
- ;*************************************************************************
-
- ;FOLD Context
- ;*************************************************
- ;** Context **
- ;** This defines the Context structure. **
- ;** It keeps informations about a MMU table **
- ;*************************************************
- rsreset
- ctx_succ: rs.l 1
- ctx_pred: rs.l 1 ;doubly linked list
- ctx_type: rs.b 1 ;NT_CONTEXT
- ctx_pri: rs.b 1 ;unused
- ctx_name: rs.l 1 ;name of this context, if any
-
- ctx_usecount: rs.w 1 ;context use count
-
- ctx_cpstart: rs.b 0
- ctx_RootMask: rs.l 1 ;this has to be filled in with -1, the root has to be masked by the setup code itself
- ;lookup tables for the MMU table builder
- ctx_LevelAMask: rs.l 1 ;alignment of the LevelA pointer table pointed to by the MMU URP
- ctx_LevelBMask: rs.l 1
- ctx_LevelCMask: rs.l 1
- ctx_LevelDMask: rs.l 1
- ctx_IndirectMask: rs.l 1 ;Alignment for indirect
- ctx_PageMask: rs.l 1 ;Alignment at page level
-
- ;the mask +1 is called alignment
- ;it is therefore the alignment of
- ;the object ONE LEVEL BELOW
- ;since at the level above only the
- ;bits mentioned in the mask are
- ;used.
-
- ctx_LevelAAlign: rs.l 1 ;alignment of the LevelA pointer table pointed to by the MMU URP
- ctx_LevelBAlign: rs.l 1
- ctx_LevelCAlign: rs.l 1
- ctx_LevelDAlign: rs.l 1
- ctx_IndirectAlign: rs.l 1 ;Alignment for indirect: Unused (must be four anyways)
- ctx_PageSize: rs.l 0 ;Page size choosen. Should be 4K
- ctx_PageAlign: rs.l 1 ;Alignment at page level: This is identical to the page size
-
- ctx_InitialShift: rs.b 1 ;Initial shift bits, only used for MC68851/MC68030
- ctx_LevelABits: rs.b 1 ;Bits for the Root Index level of the tree
- ctx_LevelBBits: rs.b 1 ;Bits for the Pointer Index level of the tree
- ctx_LevelCBits: rs.b 1 ;Bits for the Page Index level of the tree
- ctx_LevelDBits: rs.b 1 ;Bits for the Level D pointer, used only in MC68851/68030
- ctx_PageBits: rs.b 1 ;Bits for the Page Offset level of the tree
-
- ctx_InitialPos: rs.b 1 ;always zero
- ctx_LevelAPos: rs.b 1 ;Bit position of the MSB bit for the LevelA decoding. Bit 0 IS LEFTMOST. Optimized for bfextu
- ctx_LevelBPos: rs.b 1
- ctx_LevelCPos: rs.b 1
- ctx_LevelDPos: rs.b 1
- ctx_PagePos: rs.b 1
- ;the remaining lookups are filled in by the library itself
- ctx_UpperEnd: rs.l 1 ;Total upper end of the address space (0 for 2^32)
- ctx_LevelASize: rs.l 1 ;Size of an early-termination page at level A
- ctx_LevelBSize: rs.l 1
- ctx_LevelCSize: rs.l 1
- ctx_LevelDSize: rs.l 1
-
- ctx_InitialSz: rs.l 1
- ctx_LevelATableSz: rs.l 1 ;Size in entries of the pointer table at level A (not counting the user data)
- ctx_LevelBTableSz: rs.l 1
- ctx_LevelCTableSz: rs.l 1
- ctx_LevelDTableSz: rs.l 1
- ctx_PageTableSz: rs.l 1 ;Size of the MMU page table
-
- ctx_cpend: rs.b 0
-
- ctx_flags: rs.l 1 ;flags, see below
-
- ctx_Mapping: rs.l 3 ;hardware independent mapping
- ctx_RootPointer: rs.l 2 ;hardware dependent root pointer
- ctx_Root: rs.l 1 ;CPU readable address of the MMU
- ;base table
-
- ctx_Semaphore: rs.b $2e ;access to this structure
- ;the next onces are the switch
- ;and lauch entries for tasks
- ;added to this context.
- ;this works with a little magic
- ;a part of this structure is
- ;run as code (Urgh)
- ctx_SwitchEntry: rs.w 3 ;A JSR $xxxx
- ctx_LaunchEntry: rs.w 3 ;A JSR $xxxx
- ctx_len: rs.b 0
- ;ENDFOLD
- ;FOLD Flags
- ctxf_global = 10 ;this context contains the GLOBAL MMU table attributes
- ctxf_active = 24 ;this context is currently "loaded"
- ctxf_dirty = 31 ;this context needs rebuild
- ;ENDFOLD
- ;FOLD MapNode
- ;*************************************************
- ;** MapNode **
- ;** this structure describes the properties of **
- ;** the memory for the given context **
- ;*************************************************
- rsreset
- map_succ: rs.l 1 ;doubly linked
- map_pred: rs.l 1 ;list
- map_lower: rs.l 1 ;lower address
- map_higher: rs.l 1 ;higher address, inclusive
- map_Mask: rs.l 0 ;if this is used to modify a context: Property mask here
- map_MMUNode: rs.l 1 ;pointer for the MMU node describing this
- map_Flags: rs.l 1 ;see below
- map_Properties: rs.l 1 ;properties of this block
- map_Delta: rs.l 0 ;alternatively: The difference (!) between the logical and the physical address
- ;added to the logical address to get the physical address
- map_UserPtr: rs.l 1 ;for user data if invalid, or for memory destination if indirect
- map_len: rs.b 0
- ;ENDFOLD
- ;FOLD MapNode properties
- ;*************************************************
- ;** MapNode properties **
- ;*************************************************
- mapp_writeprotected = 2 ;page is write protected
- mapp_cacheinhibit = 6 ;cache inhibit (if on, bit 5 is precise or imprecise exception)
- mapp_supervisoronly = 7 ;page is supervisor code only
-
- mapp_userpage0 = 8 ;user page attributes 0
- mapp_userpage1 = 9 ;user page attributes 1
- mapp_global = 10 ;this is the global (public) context
- mapp_blank = 11 ;there's no memory at this space. Must be tolerated.
- mapp_copyback = 13 ;copyback mode allowed (only if cachable, '040, '060)
- mapp_invalid = 14 ;access of this page causes a segmentation fault
- mapp_remapped = 15 ;the physical memory is elsewhere. Use the userptr
- mapp_swapped = 16 ;access of this page causes a swapper exception
- mapp_rom = 17 ;ROM. Write access quietly tolerated.
- mapp_shared = 18 ;shares the table of the global NULL context
- mapp_translated = 19 ;the address space is transparently translated. Do not touch.
- mapp_imprecise = 21 ;imprecise exception mode (only if non-cacheable, '060)
- mapp_indirect = 22 ;pointer to a user provided page descriptor
- mapp_bundled = 23 ;almost identical to indirect except that all consequent pages are mapped to one address space
- mapp_nonserialized = 29 ;nonserialized access allowed (only if noncacheable, '040)
- ;ENDFOLD
- ;FOLD MapNode flags
- mapf_dirty = 31 ;this map has not been translated to the MMU yet
- ;ENDFOLD
-
-
-